# SDC API

SDC API is a set of methods that help to automate the process of interaction with SDC Verifier.

To run SDC API execute Home - Automation - SDC API Console from the ribbon.

Press Execute to run the script.

Note: SDC API can be run even if a project is not opened in SDC Verifier.

Note: Script is based on the C# programming language.

Note: Script is saved withing the SDC session and can be modified at any time.

SdcApi is a static class that contains all the available functions of SDC Verifier API. Type “SdcAPI.” to list all available functions:

Script can be saved to the text file and run from the command line. Run SDC Verifier.exe with argument –script:”PathToScript.txt” from command line:

### Important Commands

#### Project Commands

Open/start new project in SDC Verifier:

SdcApi.NewProject(projectFileName, modelFileName) - start new project with defined path (will be used in saving) and open the model from the defined path. Previous project will be saved automatically;

SdcApi.OpenProject(projectFileName) - open existing project from the defined project path. Previous project will be saved automatically;

SdcApi.OpenProjectAsTemplate (projectFileName, sourceProjectFileName, modelFileName) - start new project with defined path (will be used in saving) from existing project using the different model;

SdcApi.SaveProject() - save project;

SdcApi.SaveProjectAs(projectFilePath) - save project at custom path;

SdcApi.Exit() - close SDC Verifier without saving the project.

#### Load Commands

Commands are similar for all load types (Individual Loads, Load Sets, Load Groups and Fatigue Groups):

SdcApi.AddLoadSet(name, jobId, individualLoadsIds, factors, safetyFactor) - add single load set to defined job using ids of individual loads, respective factors (position should match with the loads) and set safety factor of the load;

SdcApi.GetLoadSets(jobId) - get all load sets from the job;

SdcApi.RemoveILoadSet(jobId, loadId) - remove load set from defined job by id;

SdcApi.RemoveLoadSets(jobId, loadIds) - remove multiple load sets by ids from the job;

SdcApi.RemoveAllLoadSets(jobId) - remove all load sets from the job;

SdcApi.ImportLoadSets(filePath, jobId) - import load sets from Excel file (see structure of the file below) to the job:

SdcApi.ImportNamesForLoadSets(filePath, jobId) - import names from Excel file (see structure of the file below). Empty names will be skipped;

SdcApi.SetSafetyFactorForLoadSet(jobId, loadId, safetyFactor) - set safety factor for load set;

It is possible to loop over all loads to set same factor for all load sets use the following code:

#### Other Commands

SdcApi.AddStandard...(title) - add standard with defined title of selected type (e.g. SdcApi.AddStandardEurocode3Fatigue("EC3 Fatigue")). Use tooltips to choose the necessary standard;

SdcApi.CreateSelectionAll(ModelInterface.MeshType meshType) - create elemental/nodal selection with the All Entities condition;

SdcApi.CreateSelectionAllWeld(ModelInterface.MeshType meshType) - create elemental/nodal selection with the All Welds condition;

SdcApi.SetYield(materialId, value) - apply the Yield Stress value to the selected material;

SdcApi.SetTensile(materialId, value) - apply the Tensile Strength value to the selected material;

SdcApi.Recognize... - start recognition of selected structural members (welds, beam members, plates). Use tooltips to choose the necessary recognition process (e.g. SdcApi.RecognizeWelds());

SdcApi.AddReportDesigner(SDC.Report.Enums.ReportType reportType) - add new report designer of the defined type (empty, full, results, model setup);

SdcApi.GenerateReport(reportId, documentPath) - generate report and export to MS Word document at the custom path;

SdcApi.GetReportItemByName(reportId, name) - find item of a defined name in the necessary report by name. Only complete match is taken into account, case is ignored;

SdcApi.ChangeLoad(item, load) - replace the load in all tables/plots at all sublevels under the selected item. Load in tables/plots with multiple loads (e.g. flow tables, histogram plots) will be changed;

SdcApi.AddComponent(selection, title = "", description = "") - add new component with a defined selection. Title and Description are optional to be set;

SdcApi.RemoveComponent(id) - remove Component from the project by Id;

SdcApi.EditComponent(id, selection, title = "", description = null) - edit selection, title and description of the component defined by Id;

SdcApi.ReplaceComponent(id, newComponent) - replaces existing component defined by Id with a new Component;

SdcApi.ExportCheckResultToFemap(loads, checks, plateBucklingCommonValues = null, exportOnlyTotalPointResult = false, exportResultByChecks = true, useCheckShortTitle = false) - calculates results for selected loads and checks and exports them to Femap. plateBucklingCommonValues, exportOnlyTotalPointResult, exportResultByChecks, useCheckShortTitle parameters are optional to be set;